<?php

	class DataFilter
	{
		public static function getPhone($phone)
		{
			//validate and fix phone numbers
			$phone = str_replace(array(' ', '-', '(', ')', '+'), '', $phone);
			if ($phone[0] == '7') {
				$phone[0] = '8';
			}

			if (strlen($phone) != 11) {
				return '';
			}

			return $phone;
		}

		public static function getFIO($fio)
		{
			$arr = explode(' ', $fio);

			$result = array();
			foreach ($arr as $v) {
				if (empty($v)) continue;

				$result[] = $v;
			}
			return implode(' ', $result);
		}
	}